<?php echo $this->load->view('meta');?>
<link rel="stylesheet" href="<?=base_url();?>css/static.css" />
<title>Live Week </title>
<?php echo $this->load->view('header'); ?>
<div class="right_content_last">
<h2>Live Week Schedule</h2>
<p>To sign up for a spot, <a href="<?base_url();?>liveweek">click here</a> </p>
<p>If you need to change your time, or cancel it altogether, please send me ("Alex Poulos") a message on facebook, or drop me an e-mail at mapoulos |AT| ncsu |DOT| edu.</p>
<table border="1">
<tr><th>Hour</th><th>Mon, Nov. 29</th><th>Tues, Nov. 30</th><th>Wed, Dec. 1</th><th>Thurs, Dec. 2</th><th>Fri, Dec. 3</th></tr>
<?php
	$bigCount = 0;
	for($h = 8; $h < 24; $h++) {
		echo("<tr>\n");
		$hour = $h;
		if($h > 12) {
			$hour = ($h-12) . ":00pm";
		} else if($h == 12) {
			$hour = $h . ":00pm";
		} else {
			$hour = $h . ":00am";
		}
		
		echo("<td>" . $hour . "</td>\n" );
		
		
		for($d = -1; $d<4; $d++) {
			if($d != 4 || $h < 17) {
			echo("<td>\n");
			
			$day = $d;
			$month = 12;
			if($d < 1) {
				$day = 30 + $d;
				$month = 11;
			}
			
			//$result = get_timeslot($month, $day, $h);
			$start = "\"2010-" . $month . "-" . $day . " " . $h . ":00:00\""; 
			
			//$result = ("SELECT * FROM liveweek WHERE date = " . $start) or die("query failed"); // . " AND date <= " . $end)
			//$result = $this->db->get('liveweek', array('date' => $start));
			$result = $this->db->query("SELECT * FROM liveweek WHERE date = " . $start);
			
			echo("<ul>\n");
			$count = 0;
			
			foreach($result->result_array() as $row) {
				$count++;
				if($count <= 4) {
					$bigCount++;
				}
			
				echo("<li>" . $row['name'] .  "</li>\n");
			}
			if($count >= 4) {
				echo("<li>***FULL***</li>\n");
			} else if($count == 0) {
				echo("&nbsp;");
			}
			
			echo("</ul>\n");
			
			echo("</td>\n");
			} else {
				echo("<td>Live Week Complete!</td>");
			}
		}
			
		echo("</tr>\n");
	}
?>
</table>

</div>
<?php //echo $this->load->view('footer');?>
